package com.quick.DP.FactoryPattern.FactoryType;

import com.quick.DP.FactoryPattern.normal.CarType.Car;

public class FactoryPatternApproach {
    public static void main(String[] args) {
        // 通过工厂创建车型对象
        Car bmw = CarFactory.createCar("BMW");
        Car tesla = CarFactory.createCar("Tesla");
        Car audi = CarFactory.createCar("Audi");
        
        // 打印车型清单（复用相同的打印方法）
        printCarInfo(bmw);
        printCarInfo(tesla);
        printCarInfo(audi);
    }
    
    // 与常规方式相同的打印方法
    private static void printCarInfo(Car car) {
        System.out.println("车型: " + car.getModel());
        System.out.println("价格: " + car.getPrice() + "元");
        System.out.println("颜色: " + car.getColor());
        System.out.println("-------------------");
    }
}